package com.jcl.recruit.resume.mapper;

import com.jcl.recruit.resume.model.ResumeEvaluate;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @ClassName ResumeEvaluateMapper

 * @Author yyliu
 * @Date 2018/9/17 9:44
 * @Version 1.0
 **/
public interface ResumeEvaluateMapper {

    @Select({
            "<script>",
            "select * from resume_evaluate",
            "<where>",
            "<if test=\"null != corpCode\"> corp_code = #{corpCode} </if>",
            "<if test=\"null != resumeId\"> and resume_id = #{resumeId} </if>",
            "</where>",
            " order by create_time desc",
            "</script>"
    })
    List<ResumeEvaluate> findList(@Param("corpCode") String corpCode,
                                  @Param("resumeId") int resumeId);

    @Insert({
            "insert into resume_evaluate ",
            "(resume_id, score, content, corp_code, add_user, create_time) ",
            "values ( ",
            "#{resumeId, jdbcType=INTEGER}, #{score, jdbcType=INTEGER}, #{content, jdbcType=VARCHAR}, ",
            "#{corpCode, jdbcType=VARCHAR}, #{addUser, jdbcType=INTEGER}, #{createTime, jdbcType=TIMESTAMP}",
            ")"
    })
    @Options(useGeneratedKeys = true, keyProperty = "id")
    int add(ResumeEvaluate resumeEvaluate);

}
